package com.example.photoview;
import javafx.scene.control.Alert;

import java.util.ArrayList;

/**
 * 完成图片复制操作
 */
public class CopyAction  {
    private HomeController homeController=(HomeController) ControllerUtil.controllers.get(HomeController.class.getSimpleName());
    /*public  CopyAction(){

        ControllerUtil.controllers.put(this.getClass().getSimpleName(), this);
        hc = (HomeController) ControllerUtil.controllers.get(HomeController.class.getSimpleName());
    }*/


    ArrayList<ImageModel> sourceList = SelectionModel.getImageModels();//存放图片本身的List
    public CopyAction(ImageBox imageBox) {
        if (sourceList.isEmpty()) {
            SelectedModel.setSourcePath((imageBox.getImageModel()).getImageFilePath());
            SelectedModel.setWaitingPasteNum(1);
        }else{
            SelectedModel.setSourcePath(sourceList);
            SelectedModel.setWaitingPasteNum(sourceList.size());
        }
        SelectedModel.setCopyOrMove(0);
        homeController.getPasteButton().setDisable(false);
        Alert alert = new Alert(Alert.AlertType.INFORMATION);
        alert.titleProperty().set("提示信息");
        alert.headerTextProperty().set("已复制到剪贴板");
        alert.showAndWait();
      imageBox.getContextMenu().hide();
    }

}